package com.translation.verb;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Iterator;

public abstract class BaseIteratorBatch implements IteratorBatch<String> {

	protected String word;
	protected Iterator<String> it;

	@Override
	public abstract void setParams(PreparedStatement st) throws SQLException;

	@Override
	public boolean result(int[] result, PreparedStatement st) throws SQLException {
		return true;
	}

	@Override
	public boolean next() throws SQLException {
		word = it.next();
		return word != null;
	}

	@Override
	public int getSize() {
		return 100;
	}

	@Override
	public void error(SQLException e) {
		if (word != null) {
			System.out.println("Near:" + word);
		}
	}

	public Iterator<String> getIterator() {
		return it;
	}

	public void setIterator(Iterator<String> it) {
		this.it = it;
	}

}
